import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class NotificationListenerTest extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => NotificationListenerState();
}

class NotificationListenerState extends State<NotificationListenerTest> {
  @override
  Widget build(BuildContext context) {
    return NotificationListener(
        onNotification: (notification) {
          print("NotificationListener：1");
          return true;
        },
        child: NotificationListener(
          onNotification: (notification) {
            print("NotificationListener：2");
            return false;
          },
          child: NotificationListener(
            onNotification: (notification) {
              print("NotificationListener：3");
              return true;
            },
            child: ListView.separated(
              itemCount: 100,
              itemBuilder: (context, index) {
                return Container(
                  width: double.infinity,
                  height: 40,
                  child: Text("item $index"),
                );
              },
              separatorBuilder: (context, index) {
                return Container(
                  width: double.infinity,
                  height: 1,
                  color: Colors.black,
                );
              },
            ),
          ),
        ));
  }
}
